package com.vsked.util;

public class JspListProcess {

	public static String getJspProjectPath(){
		return Symbol.enterSymbol+"<% String basePath = request.getScheme()+\"://\"+request.getServerName()+\":\"+request.getServerPort()+request.getContextPath()+\"/\"; %> ";
	}
	public static String getHtmlHeadBaseDefault(){
		return "<base href=\"<%=basePath%>\">";
	}
	public static String getJspJSTLC(){
		return Symbol.enterSymbol+"<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\"%>";
	}
	public static String getJspJSTLFN(){
		return Symbol.enterSymbol+"<%@ taglib uri=\"http://java.sun.com/jsp/jstl/functions\" prefix=\"fn\"%>";
	}
	public static String getJspPageStart(){
		return "<%@ page language=\"java\" import=\"java.util.*\" pageEncoding=\"UTF-8\" contentType=\"text/html; charset=utf-8\" %>"+getJspJSTLC()+getJspJSTLFN();
	}
	public static String getIncludeString(String inPagePath){
		return Symbol.enterSymbol+"<jsp:include page=\""+inPagePath+"\" >"+Symbol.enterSymbol+"</jsp:include>";
	}
	public static String getIncludeString(String inPagePath,String inParameter){
		return Symbol.enterSymbol+"<jsp:include page=\""+inPagePath+"\" >"+inParameter+Symbol.enterSymbol+"</jsp:include>";
	}
	public static String getIncludeParameterString(String inParmName,String inParmValue){
		return Symbol.enterSymbol+"<jsp:param name=\""+inParmName+"\" value=\""+inParmValue+"\" />";
	}
	
	/***********************************List process  start*************************************/
	public static String getListJspContent(){
		String listJspContent="";
		listJspContent+=getJspPageStart();
		listJspContent+=getJspProjectPath();
		listJspContent+=HtmlProcess.getXHtmlDeclareForFrameSet();
		return listJspContent;
	}
	public static String getAddOrEditJspContent(String inTableName,String inFormContent){
		String addOrEditJspContent="";
		addOrEditJspContent+=getJspPageStart();
		addOrEditJspContent+=Symbol.enterSymbol+IncludeJsp.getHeadString()+Symbol.enterSymbol+IncludeJsp.getTopString()+Symbol.enterSymbol+IncludeJsp.getLeftString()+Symbol.enterSymbol;
		addOrEditJspContent+=HtmlProcess.getFormInfo("fm"+Symbol.getStringFirstUpperCase(inTableName), Symbol.getStringFirstUpperCase(inTableName)+"Servlet?method=${sessionScope."+Symbol.getStringFirstLowerCase(inTableName)+"==null?'add':'edit'}", inFormContent);
		return addOrEditJspContent;
	}
	
	public static void main(String[] args) {
		System.out.println(getListJspContent());

	}

}
